import 'package:flame/components.dart';
import 'package:flutter_flame/worlds/game/components/bullet/ProjectileCactus.dart';
import 'package:flutter_flame/worlds/game/components/plants/CommonPlant.dart';
import 'package:flutter_flame/worlds/game/entity/SpriteAnimationParamEntity.dart';

import '../../model/PlantModel.dart';
import '../NormalZombie.dart';

// 仙人掌
class Cactus extends CommonPlant {
  Cactus({
    required super.cell,
  }) : super(
          idleEntity: SpriteAnimationParamEntity.cactusIdle,
          attackEntity: SpriteAnimationParamEntity.cactusShoot,
          plantModel: PlantModel.cactus,
          shootDelayTime: Duration(milliseconds: 700),
        );

  @override
  Future<void> attack(NormalZombie zombie) {
    world.add(ProjectileCactus(position: position + Vector2(15, 24)));
    return super.attack(zombie);
  }
}
